import request from '../utils/request';

/**
 * 查询角色列表
 * @param query
 * @returns {AxiosPromise}
 */
export const selectList = query => {
    return request({
        url: 'rest/sysRole/select',
        method: 'POST',
        data: query
    });
};

/**
 * 查询菜单列表
 * @param query
 * @returns {AxiosPromise}
 */
export const selectMenuChild = query => {
    return request({
        url: 'rest/sysMenu/selectChild',
        method: 'POST',
        data: query
    });
};

/**
 * 查询角色菜单权限
 * @param query
 * @returns {AxiosPromise}
 */
export const selectSysRoleMenu = query => {
    return request({
        url: 'rest/sysRoleMenu/' + query,
        method: 'POST',
    });
};

/**
 * 查看角色
 * @param query
 * @returns {AxiosPromise}
 */
export const selectSysRole = query => {
    return request({
        url: 'rest/sysRole/' + query,
        method: 'POST',
    });
};

/**
 * 新增角色
 * @param query
 * @returns {AxiosPromise}
 */
export const addSysRole = query => {
    return request({
        url: 'rest/sysRole/insert',
        method: 'POST',
        data: query
    });
};

/**
 * 编辑角色
 * @param query
 * @returns {AxiosPromise}
 */
export const updateSysRole = query => {
    return request({
        url: 'rest/sysRole/update',
        method: 'POST',
        data: query
    });
};

/**
 * 删除角色
 * @param query
 * @returns {AxiosPromise}
 */
export const delSysRole = query => {
    return request({
        url: 'rest/sysRole/update',
        method: 'POST',
        data: query
    });
};